data = [[1, 1, 0, 0], [0, 1, 1, 0], [1, 1, 0, 0], [0, 0, 0, 1]]
m = len(data)
n = len(data[0])
boys = [-1] * m
girls = [-1] * n


def find(i):
    for j in range(n):
        if data[i][j] and not used[j]:
            used[j] = 1
            if girls[j] == -1 or find(girls[j]):
                girls[j] = i
                boys[i] = j
                return True
    return False

for i in range(m):
    used = [0] * n
    find(i)

print(boys)
print(girls)